rename var1 id
rename var2 user_id
rename var3 qn
rename var4 qid
rename var5 order
rename var6 bid
rename var7 t_load
rename var8 t_submit
rename var9 chosen_act
rename var10 true_state
tab chosen_act true_state
gen correct=0
replace correct=1 if (true_state==3&chosen_act==1)|(true_state==3&chosen_act==3)|(true_state==3&chosen_act==5)|(true_state==3&chosen_act==6)
replace correct=1 if (true_state==4&chosen_act==2)|(true_state==4&chosen_act==7)|(true_state==4&chosen_act==8)|(true_state==4&chosen_act==9)

gen response=0
replace response=1 if (chosen_act==1|chosen_act==3|chosen_act==5|chosen_act==6)


*drop if user_id==2110 |user_id==2103| user_id==2116| user_id==2111| user_id==2106| user_id==2114| user_id==2123| user_id==2213| user_id==2210| user_id==2303| user_id==2304


xi:reg response i.true_state*i.qid, cluster(user_id)

nlcom (p1givenf_1:((_b[_Iqid_5]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_5])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_5])))(p1giveng_1:((1-_b[_Iqid_5]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_5])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_5]))) (p1givenf_2:(_b[_cons]/(2*_b[_cons]+_b[_Itrue_stat_4]))) (p1giveng_2:((1-_b[_cons])/(2-(2*_b[_cons]+_b[_Itrue_stat_4]))))  (p1givenf_3:((_b[_Iqid_6]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_6])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_6])))(p1giveng_2:((1-_b[_Iqid_6]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_6])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_6]))) (p1givenf_4:((_b[_Iqid_7]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_7])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_7])))(p1giveng_4:((1-_b[_Iqid_7]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_7])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_7])))

nlcom (ratio1_1: 5/ln(((_b[_Iqid_5]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_5])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_5]))/((1-_b[_Iqid_5]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_5])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_5])))) (ratio2_1: -5/ln((1-(_b[_Iqid_5]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_5])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_5]))/(1-(1-_b[_Iqid_5]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_5])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_5])))) (ratio1_2: 40/ln((_b[_cons]/(2*_b[_cons]+_b[_Itrue_stat_4]))/((1-_b[_cons])/(2-(2*_b[_cons]+_b[_Itrue_stat_4]))))) (ratio2_2: -40/ln((1-_b[_cons]/(2*_b[_cons]+_b[_Itrue_stat_4]))/(1-(1-_b[_cons])/(2-(2*_b[_cons]+_b[_Itrue_stat_4]))))) (ratio1_3: 70/ln(((_b[_Iqid_6]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_6])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_6]))/((1-_b[_Iqid_6]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_6])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_6])))) (ratio2_3: -70/ln((1-(_b[_Iqid_6]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_6])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_6]))/(1-(1-_b[_Iqid_6]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_6])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_6])))) (ratio1_4: 95/ln(((_b[_Iqid_7]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_7])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_7]))/((1-_b[_Iqid_7]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_7])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_7])))) (ratio2_4: -95/ln((1-(_b[_Iqid_7]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_7])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_7]))/(1-(1-_b[_Iqid_7]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_7])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_7]))))

gen state_2_DP_3=0
replace state_2_DP_3=1 if true_state==4 & qid==5
gen state_1_DP_4=0
replace state_1_DP_4=1 if true_state==3 & qid==1
gen state_2_DP_4=0
replace state_2_DP_4=1 if true_state==4 & qid==1
gen state_1_DP_5=0
replace state_1_DP_5=1 if true_state==3 & qid==6
gen state_2_DP_5=0
replace state_2_DP_5=1 if true_state==4 & qid==6

gen state_1_DP_6=0
replace state_1_DP_6=1 if true_state==3 & qid==7
gen state_2_DP_6=0
replace state_2_DP_6=1 if true_state==4 & qid==7

reg response state_2_DP_3 state_1_DP_4 state_2_DP_4 state_1_DP_5 state_2_DP_5 state_1_DP_6 state_2_DP_6, cluster(user_id)

NIAS TESTS

test state_2_DP_3
test state_1_DP_4=state_2_DP_4
test state_1_DP_5=state_2_DP_5
test state_1_DP_6=state_2_DP_6

NIAC TESTS

test -state_2_DP_3 =state_1_DP_4 -state_2_DP_4
test -state_2_DP_3 =state_1_DP_5 -state_2_DP_5
test -state_2_DP_3 =state_1_DP_6 -state_2_DP_6

test state_1_DP_4 -state_2_DP_4=state_1_DP_5 -state_2_DP_5
test state_1_DP_4 -state_2_DP_4=state_1_DP_6 -state_2_DP_6

test state_1_DP_5 -state_2_DP_5=state_1_DP_6 -state_2_DP_6

logit response state_2_DP_3 state_1_DP_4 state_2_DP_4 state_1_DP_5 state_2_DP_5 state_1_DP_6 state_2_DP_6, cluster(user_id)

test -state_2_DP_3 =state_1_DP_4 -state_2_DP_4
test -state_2_DP_3 =state_1_DP_5 -state_2_DP_5
test -state_2_DP_3 =state_1_DP_6 -state_2_DP_6

test state_1_DP_4 -state_2_DP_4=state_1_DP_5 -state_2_DP_5
test state_1_DP_4 -state_2_DP_4=state_1_DP_6 -state_2_DP_6

test state_1_DP_5 -state_2_DP_5=state_1_DP_6 -state_2_DP_6


% testnl 2/ln(((_b[_Iqid_5]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_5])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_5]))/((1-_b[_Iqid_5]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_5])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_5])))=-2/ln((1-(_b[_Iqid_5]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_5])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_5]))/(1-(1-_b[_Iqid_5]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_5])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_5])))

% testnl 10/ln((_b[_cons]/(2*_b[_cons]+_b[_Itrue_stat_4]))/((1-_b[_cons])/(2-(2*_b[_cons]+_b[_Itrue_stat_4]))))=-10/ln((1-_b[_cons]/(2*_b[_cons]+_b[_Itrue_stat_4]))/(1-(1-_b[_cons])/(2-(2*_b[_cons]+_b[_Itrue_stat_4]))))

% testnl 20/ln(((_b[_Iqid_6]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_6])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_6]))/((1-_b[_Iqid_6]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_6])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_6])))=-20/ln((1-(_b[_Iqid_6]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_6])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_6]))/(1-(1-_b[_Iqid_6]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_6])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_6])))

%testnl 30/ln(((_b[_Iqid_7]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_7])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_7]))/((1-_b[_Iqid_7]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_7])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_7])))=-30/ln((1-(_b[_Iqid_7]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_7])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_7]))/(1-(1-_b[_Iqid_7]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_7])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_7])))

%testnl 5/ln(((_b[_Iqid_5]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_5])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_5]))/((1-_b[_Iqid_5]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_5])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_5])))=40/ln((_b[_cons]/(2*_b[_cons]+_b[_Itrue_stat_4]))/((1-_b[_cons])/(2-(2*_b[_cons]+_b[_Itrue_stat_4]))))

%testnl 40/ln((_b[_cons]/(2*_b[_cons]+_b[_Itrue_stat_4]))/((1-_b[_cons])/(2-(2*_b[_cons]+_b[_Itrue_stat_4]))))=70/ln(((_b[_Iqid_6]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_6])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_6]))/((1-_b[_Iqid_6]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_6])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_6])))

%testnl 70/ln(((_b[_Iqid_6]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_6])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_6]))/((1-_b[_Iqid_6]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_6])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_6])))=95/ln(((_b[_Iqid_7]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_7])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_7]))/((1-_b[_Iqid_7]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_7])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_7])))

%testnl 5/ln(((_b[_Iqid_5]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_5])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_5]))/((1-_b[_Iqid_5]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_5])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_5])))=95/ln(((_b[_Iqid_7]+_b[_cons])/(2*(_b[_cons]+_b[_Iqid_7])+_b[_Itrue_stat_4]+_b[_ItruXqid_4_7]))/((1-_b[_Iqid_7]-_b[_cons])/(2*(1-_b[_cons]-_b[_Iqid_7])-_b[_Itrue_stat_4]-_b[_ItruXqid_4_7])))

